<!DOCTYPE html>
<!--suppress ALL -->
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 引入vue和前端配置的拦截器 -->
    <script src="js/plugins/axios/dist/axios.js"></script>
    <script src="js/plugins/vue/dist/vue.js"></script>
    <script src="js/plugins/commons.js"></script>
</head>
<body>
    <h3 id="add">接收回调参数</h3>
    <script>
        new Vue({
            el:"#add",
            data:{

            },
            methods:{

            },
            mounted() {
                // 获取code
                let code = getUrlData();
                // 发送请求
                this.$http.post("/wechat/login",code).then(function(res){
                    console.log(res);
                    if (res.data.success) {
                        // 将登录信息存入浏览器
                        localStorage.setItem("token",res.data.resultObj.token);
                        localStorage.setItem("loginInfo",res.data.resultObj.loginInfo);
                        // 跳转到首页
                        location.href = "/index.html";
                    } else {
                        // 跳转到绑定页面
                        location.href = res.data.msg;
                    }
                })
            }
        })
    </script>
</body>
</html>